<?php
	require '../../frame/base.php';

if(!isset($_REQUEST['shopid']) || !is_numeric($_REQUEST['shopid'])){
	echo json_encode(array('code'=>100,'msg'=>'信息异常'));
	exit;

}

if(!isset($_REQUEST['goodsid']) || !is_numeric($_REQUEST['goodsid'])){
	echo json_encode(array('code'=>100,'msg'=>'信息异常'));
	exit;

}

$page = 0;
$pagesize = 10;
if(isset($_GET['page'])){
	$page = (int)$_GET['page'];
}
if(isset($_GET['pagesize'])){
	$pagesize = (int)$_GET['pagesize'];
}

$page *= $pagesize;
// 需传参数
$shopid = $_REQUEST['shopid'];
$goodsid = $_REQUEST['goodsid'];

$result = $Db->table('car')->alias('a')->field('a.comments,a.comments_pic,a.sub_comments_pic,a.is_nobody,a.describe_goods,a.is_nobody,b.xia_dan_datetime,b.addtime,c.images,c.niname')->join('goodsorders b','b.ordersid = a.ordersid')->join('user c','c.userid = b.userid')->where(array('b.shopid'=>$shopid,'a.goodsid'=>$goodsid))->limit($page,$pagesize)->select();

$count = $Db->table('car')->alias('a')->field('a.comments,a.comments_pic,a.sub_comments_pic,a.is_nobody,a.describe_goods,a.is_nobody,b.xia_dan_datetime,b.addtime,c.images,c.niname')->join('goodsorders b','b.ordersid = a.ordersid')->join('user c','c.userid = b.userid')->where(array('b.shopid'=>$shopid,'a.goodsid'=>$goodsid))->count();

echo json_encode(array('code'=>200,'evaluate'=>$result,'count'=>$count));
?>